/**************************************************************
    Problem: 1010
    User: zhaolingtu
    Language: C++
    Result: 正确
    Time:3 ms
    Memory:2212 kb
    Judger:judge.aliyun1
**************************************************************/

#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, n;
  cin >> n;
  a = n / 100;
  b = n % 100 / 10;
  c = n % 10;
  if (n <= 99 || n >= 1000) {
    cout << 0;
  }
  if (a * 100 + b * 10 + c == a * a * a + b * b * b + c * c * c && n > 99 &&
      n < 1000) {
    cout << 1;
  } else {
    cout << 0;
  }

  return 0;
}